All Questions
20 questions
0votes
1answer
170views
Using sed to search multiple strings in XML file
I need to filter a big file XML and find the string using a multiple conditions. I need a filter a email if cnisfCF equal true and natg_passwordAlreadyResetedPostMigration is true. Anyone can help ? &...
-2votes
2answers
776views
sed giving me this error: … unknown command: `
I have code which will replace the xml tag at a particular line number LineNum=`grep -n "Deep" file.xml | cut -d: -f 1 | awk -F '[\t]' '{$NF = $NF -1;}1'` sed "${LineNum}s#^<...
0votes
1answer
278views
Getting syntax error exception for “expr”
I have an xml file which looks like below INPUT XML FILE <ReconSummary> <entryName>Total Deep</entryName> <Code>777</Code> <License>L</License> <Tran>...
-3votes
1answer
92views
Replace Tag of and xml file after pattern matching using shell
I have an input xml file like below INPUT FILE <ReconSummary> <entryName>Total Deep</entryName> <Code>777</Code> <License>L</License> <Tran>H20</Tran&...
-2votes
1answer
400views
sed XML parse select text between tags with special characters while deleting other blocks
I am trying to parse an XML which consists of blocks between <JOB> and </JOB> , I am parsing within a do while loop , while reading the block between <JOB> and </JOB> , I am ...
0votes
1answer
200views
How to Search XML Block and Delete the same
This is my XML. <configGroup> <type>SERVER_CONFIG</type> <configProperty id="Server48"> <configProperty> <name>Server Name</name> <...
0votes
1answer
1kviews
Variable not resolving in multi line string assignment
I'm trying to create a shell script which gives a Json block which is used further. The Json block consists of the dynamic components assigned as variables. Below is the code snippet failCount=$(cat ...
1vote
1answer
2kviews
shell script-to get the value between tags in xml
My xml file is in the below format. I want to get the value between <fullName>..</fullName> tags say ABC and DEF. I am writing this in a while loop to reach each line as I need the value ...
0votes
1answer
495views
Loop through specific set of directories
The following code loops through ALL directories under current path to perform a count on compressed xml files: for i in *xml.gz; do echo "XML" "${PWD##*/}" "$i" $(gunzip -c $i | echo "scale=0; `...
42votes
2answers
169kviews
How to insert variables inside a string containing ""?
I want to construct an xml string by inserinting variables: str1="Hello" str2="world" xml='<?xml version="1.0" encoding="iso-8859-1"?><tag1>$str1</tag1><tag2>$str2</tag2&...
1vote
3answers
1kviews
How to add tag for xml from file exist using shell linux
xml1.xml <app> <bbb> <jjj>test1</jjj> </bbb> <bbb> <jjj>test2</jjj> </bbb> </app> xml2.xml file2 xml2....
4votes
2answers
2kviews
alter a line and remove tag using perl from xml file?
I have an xml file (client_23.xml) in which I need to alter one line and remove one whole tag from it so I came up with perl script: In my xml file, I have a block like this. There will be only one ...
0votes
5answers
16kviews
How to grep an xml block in an xml file using a keyword in ksh
I have a file Sample.xml which contains a lot of services inside it and the structure looks like this Notes: I cannot use any XML parser tool as I don't have permission, read only My xmllint ...
4votes
1answer
4kviews
How to replace "&" with "&" except when already part of an XML entity?
I have a file (xml) with many &/</>/etc, but sometimes also some & characters by themselves. I want to change this symbol to & without replacing the others. cat ...
5votes
1answer
11kviews
How do I get a list of the values of matching attributes using xmllint and xpath?
I'm trying to use xmllint to parse names of Solr cores from the configuration file. This works: xmllint --xpath /solr/cores/core/@name solr.xml |grep -Po '(?<=name=")[a-z-]+(?=")' And it returns ...